package information.details;

import javax.swing.JLabel;
import javax.swing.JTextField;

public class StorageAccessDetails extends AbstractDetails {


	private static final long serialVersionUID = 1L;
	
	public StorageAccessDetails(int width) {
		super(width);
		
		this.setTitle("Kontaktinfo for tilgang");
		
		this.setupLabelArray();
		this.createTextFieldArray();
	}
	
	public void setNameText(Object data) {
		this.setPrimaryTextAt(0, data);
	}
	
	public void setPhoneText(Object data) {
		this.setPrimaryTextAt(1, data);
	}
	
	public void setEmailText(Object data) {
		this.setPrimaryTextAt(2, data);
	}
	
	public void setPositionText(Object data) {
		this.setPrimaryTextAt(3, data);
	}

	@Override
	protected void createTextFieldArray() {
		this.setupTextFields(new JTextField[4]);
	}

	@Override
	protected void setupLabelArray() {
		JLabel[] labelArray = {
			new JLabel("Navn: "),
			new JLabel("Telefon: "),
			new JLabel("E-Post: "),
			new JLabel("Stilling: ")
		};
		
		this.addLabels(labelArray);
	}

	public void populateDetails(Object[][] data) {
		for (int i = 0; i < data.length; i++) {
						
			if (i == 0)
				this.setAllPrimaryTexts(data[i]);
			else
				this.addExtraDetailRow(data[i]);
		}
	}
}
